package cn.com.elite;

import com.novell.ldap.LDAPConnection;
import com.novell.ldap.LDAPEntry;
import com.novell.ldap.LDAPException;
import com.novell.ldap.LDAPSearchResults;

public class test {
	public static void main(String[] args){
		LDAPConnection lc = new LDAPConnection();   
	       try {   
	           lc.connect("10.1.32.15",389);   
	           lc.bind(LDAPConnection.LDAP_V3,"cn=xxx","xxxxxx");   
	           LDAPSearchResults rs = lc.search("dc=hilc,dc=cn",LDAPConnection.SCOPE_SUB,"objectClass=*",null,false);   
	           int count = 0;   
	           while(rs.hasMore()){   
	               LDAPEntry entry = rs.next();   
	               System.out.println(entry.getDN());   
	               count++;   
	           }   
	           System.out.println("共有"+count+"条记录。");   
	       } catch (LDAPException e) {   
	             
	           System.err.print("连接异常！   ");   
	           e.printStackTrace();   
	       }  
	}

}
